﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using OnlineLearningSystem.IRepository;
using OnlineLearningSystem.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace OnlineLearningSystem.Controllers
{
    /// <summary>
    /// 学习进度管理
    /// </summary>
    public class LearningSituationController : BaseController
    {
        private readonly IConfiguration _configuration;
        public LearningSituationController(IUserRepository userService, ICourseRepository courseService,
            IBatchRepository batchService, ILearningSituationRepository learningSituationService,
            ITestRepository testService, ITopicRepository topicService, IConfiguration configuration)
            : base(userService, courseService, batchService, learningSituationService, testService, topicService)
        {
            _configuration = configuration;
        }

        /// <summary>
        ///学习进度添加
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public JsonResult AddUsers(Course course)
        {

            int code = 0;
            string message = "";
            try
            {
                code = 200;
                message = "提交成功！";
                //User a = _userService.Get(user.account);
                //if (_userService.Get(user.account) != null)
                //{
                //    code = 500;
                //    message = "电话号码已存在！";
                //}
                //else
                //{
                //    _userService.Create(user);
                //}
            }
            catch
            {
                code = 500;
                message = "提交失败！";
            }
            return new JsonResult(new { code, message });
        }
    }
}
